/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simpledraw;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.util.Iterator;

/**
 *
 * @author renatocardoso
 */
public class OvalShape extends Shapes
{
  Point sPoint = null;
  Point ePoint = null;
  
    @Override
  public void draw(Graphics g)
  {
    Iterator it = getList().iterator();
    //if the list does not contain the required two points, return.
    if(getList().size()<2)
    {
      return;
    }
    sPoint = (Point)it.next();
    ePoint = (Point)it.next();
    if(sPoint == null || ePoint == null)
    {
      return;
    }
    else
    {
        g.drawOval((int)sPoint.getX(), (int)sPoint.getY(), (int)(ePoint.getX()-sPoint.getX()),(int)(ePoint.getY()-sPoint.getY()));
        
    }//end of if
    //getList().clear();
  }//end of draw for Oval
}//OvalShape
